package com.jiaai.web.zfp_back.gift;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.gift.api.IGiftApi;
import com.jiaai.gift.api.IGiftHisApi;
import com.jiaai.live.model.AnchorQueryVO;
import com.jiaai.util.RestResultGenerator;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * class_name:ZBGiftHisController
 * describe:TODO
 * create_user:张昉平
 * create_date:2017/12/20
 * create_date:10:25
 */
@RestController
@RequestMapping("/api/v1/admin/gifthis")
public class ZBGiftHisController {

    @Reference
    private IGiftHisApi iGiftHisApi;

    @GetMapping("/list")
    public Object list(@RequestParam Integer curr, String anchorId, String yearMonth){
        if (StringUtils.isEmpty(yearMonth)) yearMonth = new SimpleDateFormat("yyyy-MM").format(new Date());
        return  RestResultGenerator.genSuccessResult(iGiftHisApi.getAllHis(curr, anchorId, yearMonth));
    }




}
